<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 声明一个字符串
        let str = '5201314我爱你999男神';

        // 1.正向断言：根据字符串的后面部分来确定字符串片段
        const reg = /\d+(?=男)/;
        const result = reg.exec(str);
        console.log(result);
        // 2.反向断言：根据字符串的前面部分来确定字符串片段
        const reg1 = /(?<=么)\d+/;
        const result1 = reg.exec(str);
        console.log(result);
    </script>
</body>
</html>